﻿using System;
using System.Collections.Generic;
using System.Data.Entity;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using NewsSystem.Models;
using NewsSystem.Data;

namespace NewsSystem.Client
{
    class Program
    {
        static void Main()
        {
            NewsContext context = new NewsContext();

            Image img = new Image
            {
                Title = "title",
                Url = "url//"
            };

            Vote vote = new Vote
            {
                Value = 1,
                
            };

            Article article = new Article
            {
                Content = "great article",
                CreationDate = DateTime.Now,
                Title = "title",
            };

            User user = new User
            {
                NickName = "author",
                Email = "user name",
                ExpireDate = DateTime.Now.AddDays(5)
            };

            Comment comment = new Comment
            {
                Author = user,
                Content = "great article",
                CreationDate = DateTime.Now
            };

            Comment subComment = new Comment
            {
                Author = user,
                Content = "Sub comment",
                CreationDate = DateTime.Now
            };

            comment.Comments.Add(subComment);


            article.Comments.Add(comment);
            article.Author = user;
            vote.Author = user;

            article.Votes.Add(vote);
            article.Images.Add(img);
            context.Articles.Add(article);
            context.SaveChanges();
        }
    }
}